﻿using System;

namespace WP7.Extensions.Extensions
{
    public static class DateTimeExtensions
    {
        /// <summary>
        /// Returns a value a week from your datetime object
        /// </summary>
        /// <param name="dateTime">Date time object to add a week on</param>
        /// <returns>Week from your date time object</returns>
        public static DateTime AddWeek(this DateTime dateTime)
        {
            return dateTime.AddDays(7);
        }

        /// <summary>
        /// Converts a DateTime object to Unix timestamp
        /// </summary>
        /// <returns>The Unix timestamp</returns>
        public static long ToUnixTimestamp(this DateTime date)
        {
            var dateTime = new DateTime(1970, 1, 1, 0, 0, 0);
            TimeSpan unixTimeSpan = date - dateTime;

            return (long)unixTimeSpan.TotalSeconds;
        }

    }
}
